var userreg = /^[\da-zA-Z]{4,8}$/
var passwordreg = /^\d{6}$/
var phonereg = /^1[3-9]\d{9}$/
var ele = document.querySelectorAll("input");
var sh = document.querySelectorAll("p");
console.log(sh[0].style.display)
function check(reg, value, sh) {
    if (reg.test(value)) {
        sh.style.display = "none";
    }else{
        sh.style.display = "block";
    }
}
ele[0].onblur = function() {
    check(userreg, ele[0].value, sh[0]);
}
ele[1].onblur = function() {
    check(passwordreg, ele[1].value, sh[1]);
    if (ele[2].value != "") {
        if (ele[2].value === ele[1].value) {
            sh[2].style.display = "none";
        }else{
            sh[2].style.display = "block";
        }
    }
}
ele[2].onblur = function() {
    if (ele[2].value === ele[1].value) {
        sh[2].style.display = "none";
    }else{
        sh[2].style.display = "block";
    }
}
ele[3].onblur = function() {
    check(phonereg, ele[3].value, sh[3]);
}
var checkin = document.getElementsByClassName("checkIn")[0];
console.log(checkin)
checkin.onclick = function() {
    if (sh[0].style.display === "block") {
        alert("用户名输入格式有误，请重新输入");
    }else if (sh[1].style.display === "block") {
        alert("密码输入格式有误，请重新输入");
    }else if (sh[2].style.display === "block") {
        alter("两次输入的密码不一致，请重新输入");
    }else if (sh[3].style.display === "block") {
        alert("手机号码输入有误，请重新输入");
    }
    console.log(1)
}
console.log(sh[0].style.display)
